An Analysis of Draft Picks In the NHL, NFL, NBA
Intro
In this project, our group set out to take a more in-depth analysis of draft picks over the last 20 years of three of the four major sports leagues in North America. We aimed to see what what places produced the best picks and then what teams in the leagues are the ones making the best valued picks. We pulled our dataset for the NHL, NBA, and the NFL from Kaggle.
NHL
For my dataset I decide to start off by looking at the players who
Analysis
NFL
Visualizations, particularly interactive ones, will be well-received. That said, do not overuse visualizations. You may be better off with one complicated but well-crafted visualization as opposed to many quick-and-dirty plots. Any plots should be well-thought-out, properly labeled, informative, and visually appealing.
If you want to include dynamic visualizations or tables, you should explore your options from packages that are built from htmlwidgets. These htmlwidgets-based packages offer ways to build lighterweight, dynamic visualizations or tables that don’t require an R server to run! A more complete list of packages is available on the linked website, but a short list includes:
- plotly: Interactive graphics with D3
- leaflet: Interactive maps with OpenStreetMap
- dygraphs: Interactive time series visualization
- visNetwork: Network graph visualization vis.js
- sparkline: Small inline charts
- threejs: Interactive 3D graphics
You may embed a published Shiny app in your blog if useful, but be aware that there is a limited window size for embedded objects, which tends to makes the user experience of the app worse relative to a dedicated Shiny app page. Additionally, Shiny apps will go idle after a few minutes and have to be reloaded by the user, which may also affect the user experience.
Any Shiny apps embedded in your blog should be accompanied by the link to the published Shiny app (I did this using a figure caption in the code chunk below, but you don’t have to incorporate the link in this way).
#{r ds-salaries-app, out.width = “100%”, out.extra = ‘data-external=“1” frameborder=“no”’, fig.cap = “Data Science Salaries Shiny #App”} #knitr::include_app(“https://bebailey.shinyapps.io/data-science-salaries”, # height = “500px”) #```
NBA
DT package
The DT package is great for making dynamic tables that can be displayed, searched, and filtered by the user without needing an R server or Shiny app!
Note: you should load any packages you use in the setup
code chunk as usual. The library() functions are shown
below just for demonstration.
library(DT)
mtcars %>%
select(mpg, cyl, hp) %>%
datatable(colnames = c("MPG", "Number of cylinders", "Horsepower"),
filter = 'top',
options = list(pageLength = 10, autoWidth = TRUE))kableExtra package
You can also use kableExtra for customizing HTML tables.
library(kableExtra)
summary(cars) %>%
kbl(col.names = c("Speed", "Distance"),
row.names = FALSE) %>%
kable_styling(bootstrap_options = "striped",
full_width = FALSE) %>%
row_spec(0, bold = TRUE) %>%
column_spec(1:2, width = "1.5in") | Speed | Distance |
|---|---|
| Min. : 4.0 | Min. : 2.00 |
| 1st Qu.:12.0 | 1st Qu.: 26.00 |
| Median :15.0 | Median : 36.00 |
| Mean :15.4 | Mean : 42.98 |
| 3rd Qu.:19.0 | 3rd Qu.: 56.00 |
| Max. :25.0 | Max. :120.00 |
Images
Images and gifs can be displayed using code chunks:
“Safe Space” by artist Kenesha Sneed
This is a figure caption
You may also use Markdown syntax for displaying images as shown below, but code chunks offer easier customization of the image size and alignment.